//
//  HMBaseVC.m
//  weiboOC
//
//  Created by 刘耀宗 on 16/4/8.
//  Copyright © 2016年 刘耀宗. All rights reserved.
//

#import "HMBaseVC.h"
#import "HMProVC.h"
#import "HMDisVC.h"
#import "HMHomeVC.h"
#import "HMMessageVC.h"
#import "HMTabbar.h"
#import "HMVisitorView.h"

#import "HMLoginVC.h"
@interface HMBaseVC ()<HMVisitorViewDelegate>
@property (nonatomic, assign) bool islogin;
@property (nonatomic, strong) HMVisitorView *Baseview;

@end

@implementation HMBaseVC
-(HMVisitorView *)Baseview
{
    if (_Baseview == nil) {
        _Baseview = [HMVisitorView ViewWithXib];
        _Baseview.delegate=self;
        
        
    }
    return _Baseview;


}
-(void)loadView
{
    self.islogin=YES;
    if (_islogin) {
        [super loadView];
    }
    else
    {
    
        self.view=self.Baseview;
        NSLog(@"当前view%@",self.Baseview);
  
    }



}
-(void)viewDidLoad
{
    [super viewDidLoad];
       self.view=self.Baseview;
    [self setOtherView];
    
   


}

//实现代理方法
-(void)login
{
    NSLog(@"登录了");
    
    UINavigationController *navc=[[UINavigationController alloc] initWithRootViewController:[[HMLoginVC alloc] init]];
    [self.navigationController presentViewController:navc animated:YES completion:nil];
    


}
//注册
-(void)regins
{
    NSLog(@"注册了");

}
-(void)setOtherView
{
    self.Baseview.backgroundColor=[UIColor redColor];
    if ([self isKindOfClass:[HMHomeVC class]]) {
        self.Baseview.image=[UIImage imageNamed:@"visitordiscover_image_message"];
    }
    else if ([self isKindOfClass:[HMProVC class]])
    {
    self.Baseview.image=[UIImage imageNamed:@"visitordiscover_image_profile"];
//    visitordiscover_image_message
    
    }
    else if([self isKindOfClass:[HMMessageVC class]])
    {
         self.Baseview.image=[UIImage imageNamed:@"visitordiscover_image_message"];
    }
    //创建
    self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"注册" style:UIBarButtonItemStylePlain target:self action:@selector(regins)];
    self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithTitle:@"登录" style:UIBarButtonItemStylePlain target:self action:@selector(login)];


}

@end
